#include "buildInDialog.h"
#include "newDialog.h"

buildInDialog::buildInDialog()
{
	//按钮
	customBtn = new QPushButton("custom");
	fileBtn = new QPushButton("open");
	colorBtn = new QPushButton("color");
	fontBtn = new QPushButton("font");
	saveBtn = new QPushButton("save");
	closeBtn = new QPushButton("close");
	//编辑框
	textEdit = new QTextEdit();


	//布局
	QVBoxLayout *vLay = new QVBoxLayout();
	QHBoxLayout *hLay = new QHBoxLayout();
	//垂直布局
	vLay->addWidget(customBtn);
	vLay->addWidget(fileBtn);
	vLay->addWidget(colorBtn);
	vLay->addWidget(fontBtn);
	vLay->addWidget(saveBtn);
	vLay->addWidget(closeBtn);
	//水平布局
	hLay->addWidget(textEdit);
	hLay->addLayout(vLay);
	//整体布局
	setLayout(hLay);
	//连接信号和槽
	connect(customBtn, SIGNAL(clicked()), this, SLOT(customSlot()));
}

void buildInDialog::customSlot()
{
	//创建对话框
	newDialog *p = new newDialog();
	//设置模态
	p->setModal(true);
	//显示
	p->show();
	//中断
	p->exec();
	//更新主界面
	textEdit->setText(p->str);
	//删除子框
	delete p;
}
